package com.wgts.wgts.mvp.presenter.imp;

import com.wgts.wgts.mvp.model.IThridWriteInvitationCodeModel;
import com.wgts.wgts.mvp.presenter.IThridWriteInvitationCodePresenter;
import com.wgts.wgts.mvp.view.IThridWriteInvitationCodeActivityView;
import com.wgts.wgts.netmodle.HttpResultSubscriber;
import com.wgts.wgts.netmodle.req.ThridPlatFromRequest;
import com.wgts.wgts.netmodle.resp.LoginEntity;

public class ThridWriteInvitationCodePresenter implements IThridWriteInvitationCodePresenter {

    private IThridWriteInvitationCodeActivityView view;

    private IThridWriteInvitationCodeModel model;

    public ThridWriteInvitationCodePresenter(IThridWriteInvitationCodeActivityView view, IThridWriteInvitationCodeModel model) {
        this.view = view;
        this.model = model;
    }

    @Override
    public void bindUser(String userYqCode, String uid, String smsCode, String phone, String unionid) {
        ThridPlatFromRequest request = new ThridPlatFromRequest();
        request.phone = phone;
        request.smsCode = smsCode;
        request.uid = uid;
        request.userYQCode = userYqCode;
        request.unionid = unionid;
        model.bindUser(request, new HttpResultSubscriber<LoginEntity>() {
            @Override
            public void onSuccess(LoginEntity loginEntity) {
                view.loginResult(loginEntity);
            }

            @Override
            public void _onError(int status, String msg) {
                view.onError(status, msg);
            }
        });
    }
}
